<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<div id="myDiv"></div>
	</body>
	<script>
		window.onload = function() {
			function Router() {
				this.routes = {};
				this.currentUrl = '';
			}
			Router.prototype.route = function(path, callback) {
				this.routes[path] = callback || function() {};
			};
			Router.prototype.refresh = function() {
				this.currentUrl = location.hash.slice(1) || '/';
				this.routes[this.currentUrl]();
			};
			Router.prototype.init = function() {
				window.addEventListener('load', this.refresh.bind(this), false);
				window.addEventListener('hashchange', this.refresh.bind(this), false);
			}
			window.Router = new Router();
			window.Router.init();
			window.Router.route('/', function() {
				document.getElementById('myDiv').innerHTML="sfsdfsdfsdfsdfsdfsdfjsdfjksljflsdjfk"
			});
			window.Router.route('/blue', function() {
				document.getElementById('myDiv').innerHTML="iugtirtjrtjtnkrtnhrthnkr"
			});
			window.Router.route('/green', function() {
				document.getElementById('myDiv').innerHTML="poooooooooowqejifjweofjewoijroweij"
			});
			var hash = window.location.hash;
			window.location.hash = '';
			window.location.hash = hash;
		}
	</script>

</html>